package control;

import java.io.File;

import utility.DefaultSerializer;
import utility.FileManager;
import utility.Serializer;
import data.generators.ContextCorpusGenerator;
import data.generators.CorpusGenerator;
import data.generators.DataGenerator;
import data.generators.NewsReader;
import data.stock.DataHistory;
import data.stock.NewsCorpus;
import data.stock.Ticker;

/**
 * This executive control class is used to generate test data sets
 * @author Kevin Dolan
 */
public class GenerateDataSet {

	public static void main(String[] args) {
		
		int number = 5;
		int timestep = 1;
		int timeframe = 50;
		int count = 3000;
		
		CorpusGenerator corpusGenerator = new ContextCorpusGenerator(0.5, 50, timestep, timeframe, count);
		
		NewsCorpus corpus = corpusGenerator.generate();
		
		DataGenerator generator = new NewsReader(corpus);
		
		DataHistory data = generator.generate();
		
		Ticker ticker = new Ticker("", "", corpus, new DataHistory[] {data});
		
		Serializer serializer = new DefaultSerializer();
		
		serializer.writeObject(ticker, new File("TestData/ContextCorpus/Ticker"+number+".tick"));
		
		FileManager.writeTextToFile(generator.getCsv(), new File("TestData/ContextCorpus/Corpus"+number+".csv"));
		FileManager.writeTextToFile(data.getCsv(), new File("TestData/ContextCorpus/Data"+number+".csv"));
		
		System.out.println("Operation complete.");
	}
	
}
